<?php
namespace ITSociaal\Themes\Houtgrutter;

abstract class GenericRendererFactory implements RendererFactoryInterface
{
	/**
	 * Produces RendererInterface for the given template name
	 *
	 * Based on PSR4-style class name
	 *
	 * @param string                             $name
	 * @param \ITSociaal\Themes\Houtgrutter\Util $util
	 *
	 * @return \ITSociaal\Themes\Houtgrutter\RendererInterface|null
	 */
	public static function create($name, Util $util)
	{
		$class = $util->deriveClassNameFromTemplateName(
			$name
		);

		return class_exists($class)
			? $util->createObject($class)
			: null;
	}
}

/* vi:set ts=4 sw=4 noet: */
